package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.domain.Ticket;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.ITicketService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/scenicSpotTicket")
public class TicketController {
    @Autowired
    private ITicketService ticketService;


    @RequestMapping("/list")
    public String list(@Param("qo") QueryObject qo, Model model){
        model.addAttribute("pageInfo",ticketService.query(qo));
        return "/scenicSpotTicket/list";
    }

    @RequestMapping("/saveOrUpdate")
    public String Update(Ticket ticket){
        ticketService.Update(ticket);
        return "redirect:/scenicSpotTicket/list.do";
    }

    @RequestMapping("/changeState")
    public String changeState(Integer type,Long id){
        ticketService.changeState(type,id);
        return "redirect:/scenicSpotTicket/list.do";
    }


}
